
#!/usr/bin/perl -w

use File::Spec;

my $root=shift;
defined( $root) || ($root=".");
$root= File::Spec->rel2abs($root);
chdir $root;

opendir DIR,$root;
my @subs=readdir DIR;
foreach my $s ( @subs )
{
    if( (-d $s) && !($s =~/^\./) )
    {
        my $cmd=archcmd( $s);
        print "$cmd\n";
        system ($cmd);
        system ("rm -rf $s");
    }
}
closedir DIR;

sub archcmd
{
    my $dir=shift;
#    return "jar cvf $dir.zip $dir";    
    return "\"C:/Program Files/7-Zip/7z.exe\" a -tzip $dir.zip $dir";
}
